package demo.day07

// Kotlin 惰性加载
fun main() {
//    val p = KtBase08()
//    Thread.sleep(5000)
//    println(p.readDataBase)
    val p = KtBase08()
    Thread.sleep(5000)
    println(p.readDataBase2)
}


class KtBase08 {
    val readDataBase: String = readSqlDatabaseAction()

    // 懒加载
    val readDataBase2 by lazy {
        readSqlDatabaseAction()
    }

    private fun readSqlDatabaseAction(): String {
        println("模仿加载数据数据")
        return "database data load success"
    }
}